package defpackage; import android.app.Activity; import android.app.Dialog; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Color; import android.graphics.NinePatch; import android.graphics.Rect; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.graphics.drawable.NinePatchDrawable; import android.graphics.drawable.PaintDrawable; import android.os.Build; import android.os.Bundle; import android.os.SystemClock; import android.support.v4.app.Fragment; import android.text.TextUtils; import android.util.DisplayMetrics; import android.view.View; import android.view.ViewGroup; import android.view.WindowManager; import android.webkit.CookieSyncManager; import android.widget.Button; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.RelativeLayout; import android.widget.TextView; import com.iflytek.cloud.ErrorCode; import java.io.IOException; import java.io.InputStream; import java.lang.ref.WeakReference; import java.net.URLDecoder; import org.json.JSONException; import org.json.JSONObject; import org.scribe.model.OAuthConstants; /* renamed from: zto reason: default package */ public final class zto extends ztt { public static String BJx; public static String BJy; zxj BJz; private String d; private WeakReference<Activity> e; /* access modifiers changed from: package-private */ /* renamed from: zto$a */ public class a implements zxj { zxj BJE; private final String c = "sendinstall"; private final String d = "installwording"; private final String e = "http://appsupport.qq.com/cgi-bin/qzapps/mapp_addapp.cgi"; /* renamed from: zto$a$a reason: collision with other inner class name */ abstract class AbstractView$OnClickListenerC0244a implements View.OnClickListener { Dialog BJH; AbstractView$OnClickListenerC0244a(Dialog dialog) { this.BJH = dialog; } } public a(zxj zxj) { this.BJE = zxj; } private static Drawable q(String str, Context context) { IOException e2; Drawable drawable; Bitmap bitmap; try { InputStream open = context.getApplicationContext().getAssets().open(str); if (open == null) { return null; } if (str.endsWith(".9.png")) { try { bitmap = BitmapFactory.decodeStream(open); } catch (OutOfMemoryError e3) { e3.printStackTrace(); bitmap = null; } if (bitmap == null) { return null; } byte[] ninePatchChunk = bitmap.getNinePatchChunk(); NinePatch.isNinePatchChunk(ninePatchChunk); return new NinePatchDrawable(bitmap, ninePatchChunk, new Rect(), null); } drawable = Drawable.createFromStream(open, str); try { open.close(); return drawable; } catch (IOException e4) { e2 = e4; } } catch (IOException e5) { drawable = null; e2 = e5; e2.printStackTrace(); return drawable; } } @Override // defpackage.zxj public final void onCancel() { if (this.BJE != null) { this.BJE.onCancel(); } } @Override // defpackage.zxj public final void onComplete(final Object obj) { JSONObject jSONObject; boolean z; String str; Activity activity; PackageInfo packageInfo; if (obj != null && (jSONObject = (JSONObject) obj) != null) { try { boolean z2 = jSONObject.getInt("sendinstall") == 1; str = jSONObject.getString("installwording"); z = z2; } catch (JSONException e2) { zue.d("openSDK_LOG.AuthAgent", "FeedConfirmListener onComplete There is no value for sendinstall."); z = false; str = ""; } String decode = URLDecoder.decode(str); zue.a("openSDK_LOG.AuthAgent", " WORDING = " + decode + "xx"); if (z && !TextUtils.isEmpty(decode)) { final zxj zxj = this.BJE; if (zto.this.e != null && (activity = (Activity) zto.this.e.get()) != null) { Dialog dialog = new Dialog(activity); dialog.requestWindowFeature(1); PackageManager packageManager = activity.getPackageManager(); try { packageInfo = packageManager.getPackageInfo(activity.getPackageName(), 0); } catch (PackageManager.NameNotFoundException e3) { e3.printStackTrace(); packageInfo = null; } Drawable loadIcon = packageInfo != null ? packageInfo.applicationInfo.loadIcon(packageManager) : null; AnonymousClass1 r5 = new AbstractView$OnClickListenerC0244a(dialog) { /* class defpackage.zto.a.AnonymousClass1 */ public final void onClick(View view) { Activity activity; a aVar = a.this; Bundle b2 = zto.this.b(); if (!(zto.this.e == null || (activity = (Activity) zto.this.e.get()) == null)) { ztp ztp = zto.this.BJZ; zue.a("openSDK_LOG.HttpUtils", "OpenApi requestAsync"); /* JADX ERROR: Method code generation error jadx.core.utils.exceptions.CodegenException: Error generate insn: 0x0035: INVOKE (wrap: zuq$1 : 0x0032: CONSTRUCTOR (r0v9 zuq$1) = (r1v6 'ztp' ztp) (r2v1 'activity' android.app.Activity) ("http://appsupport.qq.com/cgi-bin/qzapps/mapp_addapp.cgi") (r4v0 'b2' android.os.Bundle) (wrap: java.lang.String : ?: SGET com.google.firebase.perf.FirebasePerformance.HttpMethod.POST java.lang.String) (null zxi) call: zuq.1.<init>(ztp, android.content.Context, java.lang.String, android.os.Bundle, java.lang.String, zxi):void type: CONSTRUCTOR) type: VIRTUAL call: zuq.1.start():void in method: zto.a.1.onClick(android.view.View):void, file: classes12.dex at jadx.core.codegen.InsnGen.makeInsn(InsnGen.java:255) at jadx.core.codegen.InsnGen.makeInsn(InsnGen.java:217) at jadx.core.codegen.RegionGen.makeSimpleBlock(RegionGen.java:110) at jadx.core.codegen.RegionGen.makeRegion(RegionGen.java:56) at jadx.core.codegen.RegionGen.makeSimpleRegion(RegionGen.java:93) at jadx.core.codegen.RegionGen.makeRegion(RegionGen.java:59) at jadx.core.codegen.RegionGen.makeRegionIndent(RegionGen.java:99) at jadx.core.codegen.RegionGen.makeIf(RegionGen.java:143) at jadx.core.codegen.RegionGen.makeRegion(RegionGen.java:63) at jadx.core.codegen.RegionGen.makeSimpleRegion(RegionGen.java:93) at jadx.core.codegen.RegionGen.makeRegion(RegionGen.java:59) at jadx.core.codegen.MethodGen.addRegionInsns(MethodGen.java:244) at jadx.core.codegen.MethodGen.addInstructions(MethodGen.java:237) at jadx.core.codegen.ClassGen.addMethodCode(ClassGen.java:342) at jadx.core.codegen.ClassGen.addMethod(ClassGen.java:295) at jadx.core.codegen.ClassGen.lambda$addInnerClsAndMethods$2(ClassGen.java:264) at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183) at java.base/java.util.ArrayList.forEach(ArrayList.java:1541) at java.base/java.util.stream.SortedOps$RefSortingSink.end(SortedOps.java:395) at java.base/java.util.stream.Sink$ChainedReference.end(Sink.java:258) Caused by: jadx.core.utils.exceptions.CodegenException: Error generate insn: 0x0032: CONSTRUCTOR (r0v9 zuq$1) = (r1v6 'ztp' ztp) (r2v1 'activity' android.app.Activity) ("http://appsupport.qq.com/cgi-bin/qzapps/mapp_addapp.cgi") (r4v0 'b2' android.os.Bundle) (wrap: java.lang.String : ?: SGET com.google.firebase.perf.FirebasePerformance.HttpMethod.POST java.lang.String) (null zxi) call: zuq.1.<init>(ztp, android.content.Context, java.lang.String, android.os.Bundle, java.lang.String, zxi):void type: CONSTRUCTOR in method: zto.a.1.onClick(android.view.View):void, file: classes12.dex at jadx.core.codegen.InsnGen.makeInsn(InsnGen.java:255) at jadx.core.codegen.InsnGen.addWrappedArg(InsnGen.java:119) at jadx.core.codegen.InsnGen.addArg(InsnGen.java:103) at jadx.core.codegen.InsnGen.addArgDot(InsnGen.java:87) at jadx.core.codegen.InsnGen.makeInvoke(InsnGen.java:715) at jadx.core.codegen.InsnGen.makeInsnBody(InsnGen.java:367) at jadx.core.codegen.InsnGen.makeInsn(InsnGen.java:249) ... 19 more Caused by: jadx.core.utils.exceptions.JadxRuntimeException: Expected class to be processed at this point, class: zuq, state: GENERATED_AND_UNLOADED at jadx.core.dex.nodes.ClassNode.ensureProcessed(ClassNode.java:215) at jadx.core.codegen.InsnGen.makeConstructor(InsnGen.java:630) at jadx.core.codegen.InsnGen.makeInsnBody(InsnGen.java:363) at jadx.core.codegen.InsnGen.makeInsn(InsnGen.java:230) ... 25 more */ /* this = this; zto$a r0 = defpackage.zto.a.this zto r1 = defpackage.zto.this android.os.Bundle r4 = defpackage.zto.g(r1) zto r1 = defpackage.zto.this java.lang.ref.WeakReference r1 = defpackage.zto.e(r1) if (r1 == 0) goto L_0x0038 zto r1 = defpackage.zto.this java.lang.ref.WeakReference r1 = defpackage.zto.e(r1) java.lang.Object r2 = r1.get() android.app.Activity r2 = (android.app.Activity) r2 if (r2 == 0) goto L_0x0038 zto r0 = defpackage.zto.this ztp r1 = defpackage.zto.h(r0) java.lang.String r3 = "http://appsupport.qq.com/cgi-bin/qzapps/mapp_addapp.cgi" java.lang.String r5 = "POST" java.lang.String r0 = "openSDK_LOG.HttpUtils" java.lang.String r6 = "OpenApi requestAsync" defpackage.zue.a(r0, r6) zuq$1 r0 = new zuq$1 r6 = 0 r0.<init>(r1, r2, r3, r4, r5, r6) r0.start() L_0x0038: android.app.Dialog r0 = r7.BJH if (r0 == 0) goto L_0x0049 android.app.Dialog r0 = r7.BJH boolean r0 = r0.isShowing() if (r0 == 0) goto L_0x0049 android.app.Dialog r0 = r7.BJH r0.dismiss() L_0x0049: zxj r0 = r7 if (r0 == 0) goto L_0x0054 zxj r0 = r7 java.lang.Object r1 = r18 r0.onComplete(r1) L_0x0054: return */ throw new UnsupportedOperationException("Method not decompiled: defpackage.zto.a.AnonymousClass1.onClick(android.view.View):void"); } }; AnonymousClass2 r9 = new AbstractView$OnClickListenerC0244a(dialog) { /* class defpackage.zto.a.AnonymousClass2 */ public final void onClick(View view) { if (this.BJH != null && this.BJH.isShowing()) { this.BJH.dismiss(); } if (zxj != null) { zxj.onComplete(obj); } } }; ColorDrawable colorDrawable = new ColorDrawable(); colorDrawable.setAlpha(0); dialog.getWindow().setBackgroundDrawable(colorDrawable); DisplayMetrics displayMetrics = new DisplayMetrics(); ((WindowManager) activity.getSystemService("window")).getDefaultDisplay().getMetrics(displayMetrics); float f = displayMetrics.density; RelativeLayout relativeLayout = new RelativeLayout(activity); ImageView imageView = new ImageView(activity); imageView.setImageDrawable(loadIcon); imageView.setScaleType(ImageView.ScaleType.FIT_XY); imageView.setId(1); int i = (int) (60.0f * f); int i2 = (int) (14.0f * f); int i3 = (int) (18.0f * f); RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(i, i); layoutParams.addRule(9); layoutParams.setMargins(0, i3, (int) (6.0f * f), i3); relativeLayout.addView(imageView, layoutParams); TextView textView = new TextView(activity); textView.setText(decode); textView.setTextSize(14.0f); textView.setGravity(3); textView.setIncludeFontPadding(false); textView.setPadding(0, 0, 0, 0); textView.setLines(2); textView.setId(5); textView.setMinWidth((int) (185.0f * f)); RelativeLayout.LayoutParams layoutParams2 = new RelativeLayout.LayoutParams(-2, -2); layoutParams2.addRule(1, 1); layoutParams2.addRule(6, 1); layoutParams2.setMargins(0, 0, (int) (5.0f * f), 0); relativeLayout.addView(textView, layoutParams2); View view = new View(activity); view.setBackgroundColor(Color.rgb(214, 214, 214)); view.setId(3); RelativeLayout.LayoutParams layoutParams3 = new RelativeLayout.LayoutParams(-2, 2); layoutParams3.addRule(3, 1); layoutParams3.addRule(5, 1); layoutParams3.addRule(7, 5); layoutParams3.setMargins(0, 0, 0, (int) (12.0f * f)); relativeLayout.addView(view, layoutParams3); LinearLayout linearLayout = new LinearLayout(activity); RelativeLayout.LayoutParams layoutParams4 = new RelativeLayout.LayoutParams(-2, -2); layoutParams4.addRule(5, 1); layoutParams4.addRule(7, 5); layoutParams4.addRule(3, 3); Button button = new Button(activity); button.setText("跳过"); button.setBackgroundDrawable(q("buttonNegt.png", activity)); button.setTextColor(Color.rgb(36, 97, 131)); button.setTextSize(20.0f); button.setOnClickListener(r9); button.setId(4); LinearLayout.LayoutParams layoutParams5 = new LinearLayout.LayoutParams(0, (int) (45.0f * f)); layoutParams5.rightMargin = i2; layoutParams5.leftMargin = (int) (4.0f * f); layoutParams5.weight = 1.0f; linearLayout.addView(button, layoutParams5); Button button2 = new Button(activity); button2.setText("确定"); button2.setTextSize(20.0f); button2.setTextColor(Color.rgb(255, 255, 255)); button2.setBackgroundDrawable(q("buttonPost.png", activity)); button2.setOnClickListener(r5); LinearLayout.LayoutParams layoutParams6 = new LinearLayout.LayoutParams(0, (int) (45.0f * f)); layoutParams6.weight = 1.0f; layoutParams6.rightMargin = (int) (4.0f * f); linearLayout.addView(button2, layoutParams6); relativeLayout.addView(linearLayout, layoutParams4); ViewGroup.LayoutParams layoutParams7 = new FrameLayout.LayoutParams((int) (279.0f * f), (int) (163.0f * f)); relativeLayout.setPadding(i2, 0, (int) (12.0f * f), (int) (12.0f * f)); relativeLayout.setLayoutParams(layoutParams7); relativeLayout.setBackgroundColor(Color.rgb(247, 251, 247)); PaintDrawable paintDrawable = new PaintDrawable(Color.rgb(247, 251, 247)); paintDrawable.setCornerRadius(f * 5.0f); relativeLayout.setBackgroundDrawable(paintDrawable); dialog.setContentView(relativeLayout); dialog.setOnCancelListener(new DialogInterface.OnCancelListener() { /* class defpackage.zto.a.AnonymousClass3 */ public final void onCancel(DialogInterface dialogInterface) { if (zxj != null) { zxj.onComplete(obj); } } }); if (activity != null && !activity.isFinishing()) { dialog.show(); } } } else if (this.BJE != null) { this.BJE.onComplete(obj); } } } @Override // defpackage.zxj public final void onError(zxl zxl) { if (this.BJE != null) { this.BJE.onError(zxl); } } } /* access modifiers changed from: package-private */ /* renamed from: zto$b */ public class b implements zxj { private final zxj BJA; private final boolean c = true; private final Context d; public b(Context context, zxj zxj, boolean z) { this.d = context; this.BJA = zxj; zue.b("openSDK_LOG.AuthAgent", "OpenUi, TokenListener()"); } @Override // defpackage.zxj public final void onCancel() { zue.b("openSDK_LOG.AuthAgent", "OpenUi, TokenListener() onCancel"); this.BJA.onCancel(); zue.b(); } @Override // defpackage.zxj public final void onComplete(Object obj) { zue.b("openSDK_LOG.AuthAgent", "OpenUi, TokenListener() onComplete"); JSONObject jSONObject = (JSONObject) obj; try { String string = jSONObject.getString(OAuthConstants.ACCESS_TOKEN); String string2 = jSONObject.getString("expires_in"); String string3 = jSONObject.getString("openid"); if (!(string == null || zto.this.BJZ == null || string3 == null)) { zto.this.BJZ.iC(string, string2); zto.this.BJZ.c = string3; ztn.c(this.d, zto.this.BJZ); } String string4 = jSONObject.getString("pf"); if (string4 != null) { try { this.d.getSharedPreferences("pfStore", 0).edit().putString("pf", string4).commit(); } catch (Exception e) { e.printStackTrace(); zue.j("openSDK_LOG.AuthAgent", "OpenUi, TokenListener() onComplete error", e); } } if (this.c) { CookieSyncManager.getInstance().sync(); } } catch (JSONException e2) { e2.printStackTrace(); zue.j("openSDK_LOG.AuthAgent", "OpenUi, TokenListener() onComplete error", e2); } this.BJA.onComplete(jSONObject); zto.this.BJz = null; zue.b(); } @Override // defpackage.zxj public final void onError(zxl zxl) { zue.b("openSDK_LOG.AuthAgent", "OpenUi, TokenListener() onError"); this.BJA.onError(zxl); zue.b(); } } static { BJx = "libwbsafeedit"; BJy = BJx + ".so"; String str = Build.CPU_ABI; if (str == null || str.equals("")) { BJx = "libwbsafeedit"; BJy = BJx + ".so"; zue.c("openSDK_LOG.AuthAgent", "is arm(default) architecture"); } else if (str.equalsIgnoreCase("arm64-v8a")) { BJx = "libwbsafeedit_64"; BJy = BJx + ".so"; zue.c("openSDK_LOG.AuthAgent", "is arm64-v8a architecture"); } else if (str.equalsIgnoreCase("x86")) { BJx = "libwbsafeedit_x86"; BJy = BJx + ".so"; zue.c("openSDK_LOG.AuthAgent", "is x86 architecture"); } else if (str.equalsIgnoreCase("x86_64")) { BJx = "libwbsafeedit_x86_64"; BJy = BJx + ".so"; zue.c("openSDK_LOG.AuthAgent", "is x86_64 architecture"); } else { BJx = "libwbsafeedit"; BJy = BJx + ".so"; zue.c("openSDK_LOG.AuthAgent", "is arm(default) architecture"); } } public zto(ztp ztp) { super(ztp); } public final int a(Activity activity, String str, zxj zxj) { return a(activity, str, zxj, false, null); } /* JADX WARNING: Code restructure failed: missing block: B:5:0x0040, code lost: if (defpackage.zux.n(defpackage.zuu.a(), r0) != false) goto L_0x0042; */ /* JADX WARNING: Removed duplicated region for block: B:17:0x0123 */ public final int a(Activity activity, String str, zxj zxj, boolean z, Fragment fragment) { boolean z2; this.d = str; this.e = new WeakReference<>(activity); this.BJz = zxj; if (!zuv.cV(activity, this.BJZ.a).b("C_LoginWeb")) { zue.c("openSDK_LOG.AuthAgent", "startActionActivity() -- start"); Intent intent = new Intent(); if (zuz.d(zuu.a())) { intent.setClassName("com.tencent.minihd.qq", "com.tencent.open.agent.AgentActivity"); } intent.setClassName("com.tencent.mobileqq", "com.tencent.open.agent.AgentActivity"); if (!zux.n(zuu.a(), intent)) { intent.setClassName("com.tencent.tim", "com.tencent.open.agent.AgentActivity"); if (!zux.n(zuu.a(), intent)) { intent = null; } } if (intent != null) { Bundle gSF = gSF(); gSF.putString(OAuthConstants.SCOPE, this.d); gSF.putString(OAuthConstants.CLIENT_ID, this.BJZ.a); if (BKf) { gSF.putString("pf", "desktop_m_qq-" + BKd + "-android" + "-" + BKc + "-" + BKe); } else { gSF.putString("pf", "openmobile_android"); } gSF.putString("need_pay", "1"); Context a2 = zuu.a(); gSF.putString("oauth_app_name", a2.getApplicationInfo().loadLabel(a2.getPackageManager()).toString()); intent.putExtra("key_action", "action_login"); intent.putExtra("key_params", gSF); intent.putExtra("appid", this.BJZ.a); if (at(intent)) { this.BJz = new a(this.BJz); ztu.gSG().a(ErrorCode.MSP_ERROR_HCR_RESOURCE_NOT_EXIST, this.BJz); if (fragment != null) { zue.b("openSDK_LOG.AuthAgent", "startAssitActivity fragment"); intent.putExtra("key_request_code", ErrorCode.MSP_ERROR_HCR_RESOURCE_NOT_EXIST); fragment.startActivityForResult(ztt.c(fragment.getActivity(), intent), ErrorCode.MSP_ERROR_HCR_RESOURCE_NOT_EXIST); } else { zue.b("openSDK_LOG.AuthAgent", "startAssitActivity activity"); b(activity, intent, ErrorCode.MSP_ERROR_HCR_RESOURCE_NOT_EXIST); } zue.c("openSDK_LOG.AuthAgent", "startActionActivity() -- end, found activity for loginIntent"); zum.gSJ(); zum.a(0, "LOGIN_CHECK_SDK", "1000", this.BJZ.a, "", Long.valueOf(SystemClock.elapsedRealtime()), 0, 1, ""); z2 = true; if (z2) { zue.c("openSDK_LOG.AuthAgent", "OpenUi, showUi, return Constants.UI_ACTIVITY"); zum.gSJ(); zum.a(this.BJZ.c, this.BJZ.a, "2", "1", "5", "0", "0", "0"); return 1; } } } zum.gSJ(); zum.a(1, "LOGIN_CHECK_SDK", "1000", this.BJZ.a, "", Long.valueOf(SystemClock.elapsedRealtime()), 0, 1, "startActionActivity fail"); zue.c("openSDK_LOG.AuthAgent", "startActionActivity() -- end, no target activity for loginIntent"); z2 = false; if (z2) { } } zum.gSJ(); zum.a(this.BJZ.c, this.BJZ.a, "2", "1", "5", "1", "0", "0"); zue.d("openSDK_LOG.AuthAgent", "doLogin startActivity fail show dialog."); this.BJz = new a(this.BJz); zxj zxj2 = this.BJz; zue.c("openSDK_LOG.AuthAgent", "OpenUi, showDialog -- start"); CookieSyncManager.createInstance(zuu.a()); Bundle gSF2 = gSF(); gSF2.putString(OAuthConstants.SCOPE, this.d); gSF2.putString(OAuthConstants.CLIENT_ID, this.BJZ.a); if (BKf) { gSF2.putString("pf", "desktop_m_qq-" + BKd + "-android" + "-" + BKc + "-" + BKe); } else { gSF2.putString("pf", "openmobile_android"); } String sb = new StringBuilder().append(System.currentTimeMillis() / 1000).toString(); gSF2.putString("sign", zux.b(zuu.a(), sb)); gSF2.putString("time", sb); gSF2.putString("display", "mobile"); gSF2.putString("response_type", "token"); gSF2.putString(OAuthConstants.REDIRECT_URI, "auth://tauth.qq.com/"); gSF2.putString("cancel_display", "1"); gSF2.putString("switch", "1"); gSF2.putString("status_userip", zuz.a()); final String str2 = zuw.gSO().a(zuu.a(), "https://openmobile.qq.com/oauth2.0/m_authorize?") + zuq.ad(gSF2); final b bVar = new b(zuu.a(), zxj2, true); zue.b("openSDK_LOG.AuthAgent", "OpenUi, showDialog TDialog"); zuy.bn(new Runnable() { /* class defpackage.zto.AnonymousClass1 */ /* JADX WARNING: Code restructure failed: missing block: B:2:0x0011, code lost: r0 = (android.app.Activity) r3.BJB.e.get(); */ public final void run() { final Activity activity; zux.a(zto.BJx, zto.BJy, 3); if (zto.this.e != null && activity != null) { activity.runOnUiThread(new Runnable() { /* class defpackage.zto.AnonymousClass1.AnonymousClass1 */ public final void run() { ztq ztq = new ztq(activity, "action_login", str2, bVar, zto.this.BJZ); if (activity != null && !activity.isFinishing()) { ztq.show(); } } }); } } }); zue.c("openSDK_LOG.AuthAgent", "OpenUi, showDialog -- end"); return 2; } }